#ifndef GENUTILS_H
#define GENUTILS_H

#include <math.h>
#include <iostream>
#include <stdio.h>
#include <ctime>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include<sys/stat.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/wait.h>
#include <signal.h>

using namespace cv;
using namespace std;

const double PI = 3.14159;

//Socket details
#define PORT "40000"     // the port we'll be using
#define BACKLOG 10	 // how many pending connections queue will hold
#define MAXDATASIZE 100  // max number of bytes we can get at once 

//Globals. Must be set during runtime.
extern bool SHOULD_DRAW;
extern bool TESTING;
extern int XDIM;
extern int YDIM;
extern int N_GOAL_LINES;
extern int N_CURR_LINES;
extern double G_MEANS[3];
extern double C_MEANS[3];


//function declarations
int *addrToCoords(int addr);
int coordsToAddr(int x, int y);
double pythagoras(int valx, int valy);
double pointDist(int point1, int point2);
int* sortInts(int* toSort, int len, bool big_to_small);
int *sortDoubs(double* toSort, int len, bool big_to_small);

#include "LSR.cpp"
#include "Line.cpp"
#include "Mapping.cpp"

#endif
